% change this path if you install the VOC code elsewhere
addpath([cd '/VOCcode']);

% get devkit directory with forward slashes
devkitroot=strrep(fileparts(fileparts(mfilename('fullpath'))),'\','/');

clear VOCopts

% initialize VOC options

VOCopts.annocachepath=[devkitroot '/my_input/results' '%s_anno.mat'];

% VOCopts.testset='val'; % use validation data for development test set
VOCopts.testset='test'; % use test set for final challenge

VOCopts.annopath=[devkitroot '/my_input/kittivoc_ori_1_1/kittivoc_test' '/Annotations/%s.xml'];
VOCopts.imgsetpath=[devkitroot '/my_input/kittivoc_ori_1_1/kittivoc_test' '/ImageSets/Main/%s.txt'];

VOCopts.detrespath=[devkitroot '/my_input/detection-results/%s_det_' VOCopts.testset '_%s.txt'];

% overlap threshold

VOCopts.minoverlap=0.5;

% classes

VOCopts.classes={...
    'Car'
    'Pedestrian'
    'Cyclist'};

VOCopts.nclasses=length(VOCopts.classes);

for i=1:VOCopts.nclasses
    cls=VOCopts.classes{i};
    [recall,prec,ap]=VOCevaldet(VOCopts,'comp3',cls,true);  % compute and display PR
    
    if i<VOCopts.nclasses
        fprintf('press any key to continue with next class...\n');
        drawnow;
        pause;
    end
end
